# dic = \
#     {
#         "name": "zhangsan",
#         "lisi": [18,12345],
#         "name": "wangwu"
#     }
# print(dic["name"])
#
# dic = \
#     {
#         "山东省": [],
#         "河北省": [],
#         "浙江省": []
#     }
# list1 = [18, "山东省济南市xxxxx"]
# for i in dic:
#     if i == list1[1][0:3]:
#         dic[i].append(list1)
# for k in dic:
#     print(k, dic[k])


# file = open("text_file", mode="w")
# file.write("hello world12345")
# file.close()


# 字典
# dic = \
#     {
#         "name": "zhangsan",
#         18: 12345,
#         "list": ["lisi","wangwu",1234]
#     }

# 字典的增删查改
# 增
# name = \
#     {
#         1: "zhangsan",
#         2: "lisi",
#         3: "wnagwu"
#     }
# name[4] = "zhaoliu"  # 增加
# name["six"] = "coco"  # []加上key，加上value
# for i in name:
#     print(i,name[i])


# name = \
#     {
#         1: "zhangsan",
#         2: "lisi",
#         3: "wnagwu"
#     }
# # 删除
# # pop del clear
# ret = name.pop(1)
# print(ret)
# ret = name.pop(3)
# print(ret)
# for i in name:
#     print(i,name[i])
#

# name = \
#     {
#         1: "zhangsan",
#         2: "lisi",
#         3: "wnagwu"
#     }
# del name
# print(name)

# name = \
#     {
#         1: "zhangsan",
#         2: "lisi",
#         3: "wnagwu"
#     }
# name.clear()
# print(name)

# dic = \
#     {
#         "first": "zhangsan",
#         "second": "lisi",
#         "third": "wangwu",
#     }
# dic["second"] = "coco"
# print(dic)
# for i in dic:
#     print(i,dic[i])

# 查找  --- 只能通过key查找value，反过来就不行
# name = \
#     {
#         "first": "zhangsan",
#         "second": "lisi",
#         "third": "wangwu"
#     }
# print("second" in name)
# name.keys  name.values  name.items

# dic = \
#     {
#         "first": "zhangsna",
#         18: "lisi",
#         "wangwu": 12345678,
#         "lsit1": [123,3.14,"coco"]
#     }
# for i in dic.keys():
#     print(i)
# for i in dic.values():
#     print(i)
# for k in dic.items():
#     print(k)
# for i1, i2 in dic.items():
#     print(i1, i2)

# name = \
#     {
#         "first": "zhangsan",
#         "second": "lisi",
#         "third": "wangwu"
#     }
# print(name)
# for i in name:  # 推荐
#     print(i, name[i])
# for i in name.items():
#     print(i)

# len函数   ---  字符，列表，字典都可以使用
# char = "zhangsan"
# list1 = ["lisi", 3.14, 520, 1234, ["coco", "jack"]]
# dic = \
#     {
#         "first": "zhangsna",
#         18: "lisi",
#         "wangwu": 12345678,
#         "lsit1": [123,3.14,"coco"]
#     }
# print(len(char))
# print(len(list1))
# print(len(dic)

# f = open(file="file.text.txt", mode="w")
# f.write("hello world\n")
# f.write("congratulations!\n")
# f.close()
#
# file_a = open("file.text.txt", mode="a")
# file_a.write("zhangsan\n")
# file_a.write("lisi\n")
# file_a.write("finish\n")
# file_a.close()
#
# file_b = open("file.text.txt", mode="a")
# file_b.write("hahahahhahhaha\n")
# file_b.write("woshichaoren\n")
# file_b.close()
#
# file_c = open("file.text.txt", mode="a")
# file_c.write("这是今天的Python所学知识！！！\n")
# file_c.close()
#
# # 新建一个文件和写入一个文件的方式不同
# # 新建
# file = open(file="Python.txt", mode="w")
# file.write("hello Python!")
# file.close()
#
# # 写入
# file = open("Python.txt",mode="w")
# file.write("hello world\n")
# file.write("I love Python!\n")
# file.close()
#
# file = open("Python.txt",)
# print(file.readline())
# print()
# print(file.readline())
# # 注意光标位置
# file = open("Python.txt",mode="a")
# file.write("I wish to have a good day tomorrow!\n")
# file.close()

# 新建
# file = open(file="xxxxxxxxx.txt",mode="")
# 写入
# file = open("xxxxxxxx.txt",mode=" r + w + a ")


# 字符函数的在复习
# upper and lower
# char = input("Enter a character: ")
# print(char.upper())
# char = input("enter your character: ")
# print(char.lower())
# 开始结束判断 startswith and endswith
# char = "I am a string"
# print(char.startswith("I am"))
# print(char.startswith("I an"))
# char = input("enter your character:")
# print(char.endswith("string"))
# isdigit
# char = input("enter your number:")
# print(char.isdigit())

# strip
# char = input("Enter a character: ")
# print(char.strip())